How to create a package on Conda-forge

Some videos about conda and conda-forge

Workflow


In [1]:
from IPython.display import HTML

In [2]:
HTML('<iframe src="https://conda-forge.org/" width="100%" height="500px"></iframe>')


Out[2]:

Example

We will use ibis-framework as example (https://github.com/conda-forge/ibis-framework-feedstock).

Basically, all code/configuration you we need to do we will do on recipe folder. At least should exist the meta.yaml file inside that folder, but could exist more files there, such as:

  • (e.g.) LICENSE (when there is no license on the original package (e.g. package from pypi or github)
  • build.[sh,bat] (additional script that builds the package for linux/osx and windows respectively)
  • run_test.[py,pl,sh,bat] (additional test scripts)

The common information we need to set is:

  • name
  • version
  • sha256
  • url of the source
  • requirements
  • tests

In this example we will just take a look into meta.yaml.

# https://github.com/conda-forge/ibis-framework-feedstock/blob/master/recipe/meta.yaml
{% set version = "0.13.0" %}
{% set tag = "v" + version %}
{% set extension = "tar.gz" %}
{% set fn = tag + "." + extension %}

package:
  name: ibis-framework
  version: {{ version }}

source:
  fn: {{ fn }}
  url: https://github.com/ibis-project/ibis/archive/{{ fn }}
  sha256: 3da1b51c72e074183abb08a2724a5b77f90e7328ab014de5ff7e699daf5c75f9
# if you get the package from pypi you can see the sha256 on the download page of the package
# like https://pypi.org/project/ibis-framework/#files
# if you are using a package from another source you can download the package and use
# openssl sha256 PACKAGE_FILE

build:
  number: 2
  script: python setup.py install --single-version-externally-managed --record record.txt

# if you are creating a package for a new version, you should put build number: 0
# if you are just rebuilding the package you should increase the build number

requirements:
  # build requirements is just the libraries you need to build your package
  # in another words, the libraries you need to compile your package
  build:
    - enum34  # [py27]
    - funcsigs  # [py27]
    - functools32  # [py27]
    - multipledispatch
    - numpy >=1.10.0
    - pandas >=0.18.1
    - python
    - regex
    - setuptools
    - six
    - toolz
  # the run requirements is the dependencies of your library to run
  run:
    - clickhouse-driver >=0.0.8
    - enum34  # [py27]
    - funcsigs  # [py27]
    - functools32  # [py27]
    - google-cloud-bigquery <0.28
    - graphviz
    - impyla >=0.14.0
    - multipledispatch
    - numpy >=1.10.0
    - pandas >=0.18.1
    - pathlib2  # [py27]
    - psycopg2
    - pyarrow >=0.6.0  # [unix or (win64 and (py35 or py36))]
    - pymysql
    - pytables >=3.0.0
    - python
    - python-graphviz
    - python-hdfs >=2.0.16
    - regex
    - setuptools
    - six
    - sqlalchemy >=1.0.0,<1.1.15
    - thrift 0.9.3  # [py27]
    - thriftpy <=0.3.9  # [py27]
    - toolz

# conda-forge requires some test to be sure that the package will work after installation
test:
  requires:
    - pytest >=3
    - mock  # [py27]
  imports:
    - ibis
    - ibis.expr
    - ibis.expr.tests
    - ibis.hive
    - ibis.hive.tests
    - ibis.impala  # [linux]
    - ibis.impala.tests  # [linux]
    - ibis.spark
    - ibis.spark.tests
    - ibis.sql
    - ibis.sql.presto
    - ibis.sql.presto.tests
    - ibis.sql.redshift
    - ibis.sql.redshift.tests
    - ibis.sql.sqlite
    - ibis.sql.sqlite.tests
    - ibis.sql.tests
    - ibis.sql.vertica
    - ibis.sql.vertica.tests
    - ibis.tests

# this is some information about the package
about:
  license: Apache 2.0
  # generally is necessary to put the license file
  # if there is no license on the original package, 
  # is recommended to create a license file
  # https://conda-forge.org/docs/meta.html#packaging-the-license-manually
  home: http://www.ibis-project.org
  summary: 'Productivity-centric Python Big Data Framework'

extra:
  recipe-maintainers:
    - cpcloud
    - mariusvniekerk
    - wesm

# when all changes is done, be sure that all comments are removed.